import request from "@/utils/request";
import type { HospitalResponseData,HospitalLevelAndRegionResponseData,HospitalInfoResponseData } from "./type";

// 通过枚举管理首页模块接口地址
enum API {
    //  分页获取医院列表
    HOSPITAL_PAGE_URL = "/hosp/hospital/",
    //获取医院的等级与地区接口
    HOSPITALLEVElANDREGION_URL = '/cmn/dict/findByDictCode/',
    //根据关键字医院的名字获取数据
    HOSPITALINFO_URL = '/hosp/hospital/findByHosname/'
}


// 获取医院列表
export const reqHospital = (page: number, limit: number, hoscode: String = '', hosname: String = '', hostype: String = '', districtCode: String = '') => request.get<any, HospitalResponseData>(API.HOSPITAL_PAGE_URL + `${page}/${limit}`, {
    params: { hoscode, hostype, hosname, districtCode }
})

// 获取医院的等级或者获取医院地区的数据
export const reqHospitalLevelAndRegion = (dictCode: string) => request.get<any, HospitalLevelAndRegionResponseData>(API.HOSPITALLEVElANDREGION_URL + dictCode)

//根据关键字获取医院的数据进行展示
export const reqHospitalInfo = (hosname: string) => request.get<any, HospitalInfoResponseData>(API.HOSPITALINFO_URL + hosname);